<?php

define('IN_OS', true);
define('ROOT_PATH', str_replace('includes/modules/cron/trade2order.php', '', str_replace('\\', '/', __FILE__)));
require(ROOT_PATH . 'data/config.php');
require(ROOT_PATH . 'includes/inc_constant.php');
require(ROOT_PATH . 'includes/cls_openshop.php');
require(ROOT_PATH . 'includes/cls_mysql.php');
$os = new OS($db_name, $prefix);
$db = new cls_mysql($db_host, $db_user, $db_pass, $db_name);
$db_host = $db_user = $db_pass = $db_name = NULL;
require(ROOT_PATH . 'includes/lib_common.php');
require(ROOT_PATH . 'includes/lib_base.php');
require(ROOT_PATH . 'includes/lib_time.php');

//require(ROOT_PATH . 'includes/modules/taobao.api/lib_taobao2os.php');
//require(ROOT_PATH . 'includes/modules/taobao.api/lib_taobao.php');
require(ROOT_PATH . 'includes/modules/taobao.api/cls_api.php');
require(ROOT_PATH . 'admin/includes/cls_exchange.php');

define('SOURCE_PATH', ROOT_PATH . $os->source_dir() . '/');

$_CFG = load_config();

//API系统参数
$topParamArr = array(
	'api_key' =>   $_CFG['taobao_app_key'] ,
	'method' => 'taobao.trades.sold.get', //taobao.item.get
	'format' => 'xml',
	'v' => '1.0',
	'timestamp' => date('Y-m-d H:i:s'),
	'session' => $_CFG['taobao_sessionkey'],
	'nick' => $_CFG['taobao_user']
);

trade2order();

function admin_log($sn = '', $action, $content)
{
    $log_info = $GLOBALS['_LANG']['log_action'][$action] . $GLOBALS['_LANG']['log_action'][$content] .': '. addslashes($sn);

    $sql = 'INSERT INTO ' . $GLOBALS['os']->table('admin_log') . ' (log_time, user_id, log_info, ip_address) ' .
            " VALUES ('" . gmtime() . "', 0, ' ', '" . real_ip() . "')";
    $GLOBALS['db']->query($sql);
}
  
?>